/*
 * @功能描述: 
 * @版本: v1.0.0
 * @作者: LuAn
 * @Date: 2021-08-31 18:00:49
 * @LastEditTime: 2021-08-31 19:43:49
 */
#include "bsp_exit.h"
#include "bsp_delay.h"
#include "bsp_led.h"
#include "bsp_beep.h"
static void exit_irq_handler(uint32_t nIRQ, void *args)
{
  static unsigned char state = 0;

  /*
	 *采用延时消抖，中断服务函数中禁止使用延时函数！因为中断服务需要
	 *快进快出！！这里为了演示所以采用了延时函数进行消抖，后面我们会讲解
	 *定时器中断消抖法！！！
 	 */

  delay(10);
  if (gpio_pinread(GPIO1, 18) == 0) /* 按键按下了  */
  {
    state = !state;
    beep_switch(state);
  }
  gpio_clr_ints(GPIO1, BSP_GPIO_PIN_18);
}
void test_main_exit()
{
  led_init();
  beep_init();
  exit_init();
  exit_set_irq_handler(exit_irq_handler, NULL);
  while (1)
  {
    led_switch(0, ON);
    delay(500);
    led_switch(0, OFF);
    delay(500);
  }
}